import java.util.concurrent.CountDownLatch;

/**
 * @author Jiange
 * @create 2021-07-16-12:55
 */
public class CountDownLatchDemo {
    public static void main(String[] args) throws InterruptedException {
        //在计数器不为0时一直等待 为0才唤醒
        CountDownLatch countDownLatch = new CountDownLatch(6);
        for (int i = 0; i < 6; i++) {
            new Thread(()->{
                System.out.println(Thread.currentThread().getName()+"----");
                countDownLatch.countDown();
            },String.valueOf(i)).start();
        }
        countDownLatch.await();
        System.out.println("关门");
    }
}
